#ifndef PAGELIB_H
#define PAGELIB_H

#include "inicpp.hpp"
#include "tinyxml2.h"

#include <iostream>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <fstream>
#include <regex>
#include <sstream>


using std::string;
using std::map;
using std::set;
using std::vector;
using std::ofstream;


struct RssItem
{
    string title;
    string link;
    string description;
    //string content;
};

class PageLib
{
public:
    PageLib(inicpp::IniManager* ini);
    ~PageLib();//析构函数中释放申请的内存资源

    void analyze();

private:
    vector<RssItem> parseRss(string filename);//解析
    //传入网页库，网页位置库，去重网页库的文件流对象
    void dump(ofstream& ofsRipepage, ofstream& offset, vector<RssItem> rss);//输出

    vector<string> getFileNamesInDirectory(const string& directoryPath);
    vector<string> getFileNamesInDirectoryAndMove(const string& directoryPath);
private:
    vector<string> _files;//文件夹下文件
    int _docId;//doc的id
    size_t _positionInFile;//doc在文件中位置
    set<uint64_t> _webDataSimhash;//存放每个网页数据的simhash值

    inicpp::IniManager* _ini;
};


#endif //PAGELIB_H